package com.first.orange.beans;

import lombok.Data;

/**
 * Created:  2021-07-02.
 *
 * Author: zhukang
 *
 * Description: 分页实体
 */
@Data
public class PageSupport {

	// 总条数
	private int totalCount;

	// 页面容量
	private int pageSize = 12;

	// 当前页码
	private int currPageNo = 1;

	// 总页码
	private int totalPage;

	public void setTotalCount(int totalCount) {
		// 当总条数和页面容量确定时，总页数也就确定了
		if(totalCount > 0){
			this.totalCount = totalCount;
			
			// 计算总页数
			if(this.totalCount % this.pageSize == 0){
				this.setTotalPage(this.totalCount / this.pageSize);
			} else {
				this.setTotalPage(this.totalCount / this.pageSize + 1);
			}
		}
	}

}
